<?php
/**
 * @author kwor
 * @url http://www.kwor.cn
 *
 */
session_start();
require_once '../../admin/data/mysql_config.php';
header("Content-Type:text/html;charset=".SN_CHARSET);
require_once '../../admin/inc/lib/base/lib_common.php';
require_once '../../admin/inc/lib/base/cls_template.php';
require_once '../../admin/inc/lib/base/cls_pageination.php';
require_once '../../admin/inc/lib/base/cls_plugins.php';
require_once '../../admin/inc/lib/base/cls_email.php';

$xueniao = new cls_template;

if (!file_exists('temp/caches'))
{
	@mkdir('../../temp/caches', 0777);
	@chmod('../../temp/caches', 0777);
}

if (!file_exists('../../temp/compiled/tuan'))
{
	@mkdir('../../temp/compiled/tuan', 0777);
	@chmod('../../temp/compiled/tuan', 0777);
}

clearstatcache();
$pageination=new pageination();//实例化分页类
$systemconf=$db->getrow('select * from sn_system ');
$lang=$systemconf['lang'];
$editor=$systemconf['editor'];
$tempath=$systemconf['skin'];
$systemmail=$systemconf['mail'];


//语言、模板文件选择
include_once("lang/".$lang."/base.php");
$xueniao->template_dir   = "templates/".$tempath."/";
$xueniao->cache_dir      = "temp/cache/";
$xueniao->compile_dir    = "../../temp/compiled/tuan";
$siteinfo_c=array(
checkcode=>'../../admin/inc/lib/base/lib_chkcode.php',
tempath=>"templates/".$tempath."/",
title=>$systemconf['title'],
keywords=>$systemconf['keywords'],
discretion=>$systemconf['discretion'],
url=>$systemconf['url'],
icp=>$systemconf['icp'],
logo=>$systemconf['logo'],
systemmail=>$systemconf['mail'],
username=>$_SESSION['username'],
usertel=>$_SESSION['tel'],
version=>SYS_VERSION
);
$xueniao->assign("siteinfo",$siteinfo_c);


//城市id获取
if($_REQUEST['city']==''){
	if($_SESSION['city']==''){
		$_SESSION['city']=1;
	}
}else {
	$_SESSION['city']=$_REQUEST['city'];
}


$sqlcitylist="select * from sn_city";
$topcitylist=$db->getlist($sqlcitylist);
$xueniao->assign('topcitylist',$topcitylist);
$xueniao->assign('city',get_cityname_byid($_SESSION['city']));
$xueniao->assign('cityurl','?city='.$_SESSION['city']);

function chkcity() {
	$hsoodssql='select * from sn_group_goods where is_close = "N" and  city = '.$_REQUEST['city'];
	$hsoods=$GLOBALS[db]->getrow($hsoodssql);
	if(!$hsoods){
		local_header('do.php?action=subc');
		//EXIT();
	}
}

//检测登陆状态
function chklogin() {
	if($_SESSION['username']!==null ){
		local_header('do.php?action=ucenter');
	}
}
function chkunlogin() {
	if($_SESSION['username']==null || $_SESSION['username']==''){
		local_header('do.php');
	}
}

function chkmenc() {
	if($_SESSION['memberid']==""||$_SESSION['memberid']==null){
			local_header('do.php?action=mlogin');
		}
	
}

?>